package myapps.ttclient.protocol.message;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

import myapps.ttclient.Helper;
import myapps.ttclient.baseclass_and_interface.TTClientMessage;


public class AdminAuthentificationResponseMessage extends TTClientMessage
{
	public boolean authentificated;
	
	public byte[] encryptedTempKey;
	
//	public String tempKey;

	public AdminAuthentificationResponseMessage(boolean authentificated, byte[] encryptedTempKey)
	{
		this.authentificated = authentificated;
		this.encryptedTempKey = encryptedTempKey;
	}
	
	public static TTClientMessage parse(DataInputStream dis) throws IOException
	{
		boolean authentificated = dis.readBoolean();
		
		//String tempKey = Helper.ParseAsString(dis); 
		
		byte[] encryptedTempKey = Helper.ParseAsByteArray(dis); 
		
		return new AdminAuthentificationResponseMessage(authentificated, encryptedTempKey);
	}
	
	@Override
	public void toDataOutputStream(DataOutputStream dos) throws IOException
	{
		throw new IOException("NotImplementedMessage");
	}
}
